package junitTest;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;


class TriangleTest {

    @Test
    void testTriangle() {
        Triangle triangle = new Triangle();

        String type = Triangle.classify(3, 4, 6);
        assertEquals("不等边三角形", type);
    }

    @Test
    void equallaterialTriangle() {
        Triangle triangle = new Triangle();

        String type = Triangle.classify(3, 3, 3);
        assertEquals("等边三角形", type);
    }

    @Test
    void notTriangle() {
        Triangle triangle = new Triangle();

        String type = Triangle.classify(3, 3, 6);
        assertEquals("非三角形", type);
    }

    @ParameterizedTest
    @CsvSource({
            "3,4,6,不等边三角形",
            "3,3,3,等边三角形",
            "3,3,6,非三角形",
            "3,4,5,不等边三角形",
            "5,12,13,不等边三角形"
    })
    void paramTriangle(int a, int b,int c,String expected) {
        Triangle triangle = new Triangle();

        String type = Triangle.classify(a, b, c);

        assertEquals(expected, type);
    }
}
